import tool from "./tool";
//import toolVuex from "./vuex/ToolVuex.js";
//import toolCloud from "./cloud/tool-cloud.js";
//import toolApis from "./http/ToolApis.js";
//import toolImg from "./tool-img.js";
//
import vueDirective from "./vue/directive/index.js";
import vueMixin from "./vue/mixin/index.js";
import element from "./element";
import toolElement from "./element/tool";
import dayjs from "dayjs";
import toolRandom from "./tool-random";
import ComStore from "../stores";
import ComApi from "../api";
import toolImg from "./tool-img";
import toolRegex from "./tool-regex";
import toolAxios from "./http/tool-axios";


let toolIndex = {
  install(app) {
    let Tool = {
      $tool: tool,
      $dayjs: dayjs,
      $random: toolRandom,
      $element: toolElement,
      $img: toolImg,
      $reg: toolRegex,
      $axios: toolAxios,
      //            $toolApis: toolApis,
      //            $toolImg: toolImg,
      //            $request: (action, params) => toolCloud.init().send(action, params),
      //            log: param => toolVuex.commit("log/log", param)
    };

    Object.assign(app.config.globalProperties, Tool);
    Object.assign(window, Tool);

    toolIndex.initPluge(app);
  },
  initPluge(app) {
    // 初始化vue自定义指令
    app.use(vueDirective);
    // 初始化 mixins
    app.use(vueMixin);
    // element
    app.use(element);
    // 状态管理
    app.use(ComStore);
    // api 插件
    app.use(ComApi);
  },
};

export default toolIndex;
